#ifndef SERIALTHREAD_H
#define SERIALTHREAD_H

#include <QObject>
#include <QThread>
#include <QWaitCondition>
#include <QMutex>
#include <QDebug>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QMessageBox>

class SerialThread : public QThread
{
    Q_OBJECT

public:
    SerialThread(QString port, long baud, QString stop,int data, QString check);

    void run();


signals:
    void senddata(QByteArray,int,int,int,int,int);//向主线程发送接收到的串口数据
    void senderrordata(char);
    void sendmsgbox(void);

public slots:

    void read_serial_data();//读取串口数据

    void close_mthread_serial();//关闭

private:

    QSerialPort *serial;

    QString myport;
    long myBaud;
    QString mystop;
    int mydata;
    QString mycheck;

    float data;

    void setBaudRate();
    void setStopBits();
    void setDataBits();
    void setCheckBits();
};

#endif // SERIALTHREAD_H



